import torch
import itertools
import sys
sys.path.append("/root/autodl-tmp/svn/2023/mir-former/")
sys.path.append("/root/autodl-tmp/svn/2023/mir-former/detectron2")
sys.path.append("/root/autodl-tmp/svn/2023/mir-former/mask2former")
# from mask2former.utils.TripletCenterLoss import TripletCenterLoss

centers = torch.randint(0,3,(3,2)).to(torch.float)
centers_ref = centers
dis_cenmap = torch.cdist(centers, centers_ref, p=2)

loss_min = dis_cenmap.min() 


triloss = TripletCenterLoss()
feat = torch.rand((128,1024))
targets = torch.randint(0,200,(128,))
res = triloss(feat,targets)
res = 2